import time
def of(filename):
    file = open(filename, 'r')
    cho = file.readlines()
    return cho
def so(n):
    s = True
    while s:
        s = False
        for i in range(len(n) - 1):
            if n[i] > n[i+1]:
                n[i], n[i+1] = n[i+1], n[i]
                s = True
f_1 = of('m1_sorted.txt')
f_2 = of('m2_reverse.txt')
f_3 = of('m3_shuffle.txt')
start = time.time()
so(f_1)
finij = time.time()
print('m1_sorted', round(finij - start) * 1000, 'milliseconds')
start = time.time()
so(f_2)
finij = time.time()
print('m2_reverse', round(finij - start) * 1000, 'milliseconds')
start = time.time()
so(f_3)
finij = time.time()
print('m3_shuffle', round(finij - start) * 1000, 'milliseconds')
